package com.hzhr.iot.statis.convertor;

import com.hzhr.iot.statis.convertor.custom.*;
import com.hzhr.iot.core.util.HzhrTypeUtil;
import com.hzhr.iot.core.util.HzhrJsonUtil;
import java.util.Map;
import com.hzhr.iot.statis.model.deviceDailyGasConsume.DeviceDailyGasConsumeModel;
import com.hzhr.iot.statis.entity.DeviceDailyGasConsumeEntity;
import com.hzhr.iot.statis.entity.ext.DeviceDailyGasConsumeEntityExt;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import com.hzhr.iot.statis.model.deviceDailyGasConsume.DeviceDailyGasConsumeModel;
import com.hzhr.iot.statis.model.deviceDailyGasConsume.DeviceDailyGasConsumeGetModel;
import com.hzhr.iot.statis.model.deviceDataStatisExceptionReport.DeviceDataStatisExceptionReportModel;
import com.hzhr.iot.statis.model.deviceDataStatisExceptionReport.DeviceDataStatisExceptionReportGetModel;
import com.hzhr.iot.statis.queryModel.custom.DeviceDailyGasConsumeCustomQueryModel;

@Component
public class DeviceDailyGasConsumeConvertor {
    @Autowired
    DeptDailyGasConsumeCustomConvertor deptDailyGasConsumeCustomConvertor;
    @Autowired
    DeptMonthlyGasConsumeCustomConvertor deptMonthlyGasConsumeCustomConvertor;
    @Autowired
    DeviceCollectDeviceCustomConvertor deviceCollectDeviceCustomConvertor;
    @Autowired
    DeviceDataExceptionCustomConvertor deviceDataExceptionCustomConvertor;
    @Autowired
    DeviceHourlyGasConsumeCustomConvertor deviceHourlyGasConsumeCustomConvertor;
    @Autowired
    DeviceIotDeviceCustomConvertor deviceIotDeviceCustomConvertor;
    @Autowired
    DeviceMonthlyGasConsumeCustomConvertor deviceMonthlyGasConsumeCustomConvertor;
    @Autowired
    GasUserDailyGasConsumeCustomConvertor gasUserDailyGasConsumeCustomConvertor;
    @Autowired
    GasUserMonthlyGasConsumeCustomConvertor gasUserMonthlyGasConsumeCustomConvertor;
    @Autowired
    OptionsCustomConvertor optionsCustomConvertor;

    public DeviceDailyGasConsumeEntity deviceDailyGasConsumeModel2entity(DeviceDailyGasConsumeModel in) {
        //未转换字段: id 
        if (in == null) return null;
        DeviceDailyGasConsumeEntity result = new DeviceDailyGasConsumeEntity();

        result.setCollectDeviceId(HzhrTypeUtil.integer2integer(in.getCollectDeviceId()));
        result.setIotDeviceId(HzhrTypeUtil.integer2integer(in.getIotDeviceId()));
        result.setGasUserId(HzhrTypeUtil.integer2integer(in.getGasUserId()));
        result.setDeptId(HzhrTypeUtil.integer2integer(in.getDeptId()));
        result.setCompanyId(HzhrTypeUtil.integer2integer(in.getCompanyId()));
        result.setData(HzhrTypeUtil.double2double(in.getData()));
        result.setDate(HzhrTypeUtil.long2date(in.getDate()));
        result.setDataStatus(HzhrTypeUtil.string2string(in.getDataStatus()));
        return result;
    }
    public DeviceDailyGasConsumeEntity deviceDailyGasConsumeModel2entity(DeviceDailyGasConsumeModel in, DeviceDailyGasConsumeEntity ori) {
        //未转换字段: id 
        if (in == null) return null;
        DeviceDailyGasConsumeEntity result = ori;

        result.setCollectDeviceId(HzhrTypeUtil.integer2integer(in.getCollectDeviceId()));
        result.setIotDeviceId(HzhrTypeUtil.integer2integer(in.getIotDeviceId()));
        result.setGasUserId(HzhrTypeUtil.integer2integer(in.getGasUserId()));
        result.setDeptId(HzhrTypeUtil.integer2integer(in.getDeptId()));
        result.setCompanyId(HzhrTypeUtil.integer2integer(in.getCompanyId()));
        result.setData(HzhrTypeUtil.double2double(in.getData()));
        result.setDate(HzhrTypeUtil.long2date(in.getDate()));
        result.setDataStatus(HzhrTypeUtil.string2string(in.getDataStatus()));
        return result;
    }
    public List<DeviceDailyGasConsumeEntity> deviceDailyGasConsumeModelList2entityList(List<DeviceDailyGasConsumeModel> in) {
        if (in == null) return null;
        List<DeviceDailyGasConsumeEntity> result = new ArrayList<>();
        for (DeviceDailyGasConsumeModel item : in) {
            result.add(deviceDailyGasConsumeModel2entity(item));
        }
        return result;
    }
    public DeviceDailyGasConsumeModel entity2deviceDailyGasConsumeModel(DeviceDailyGasConsumeEntity in) {
        //未转换字段: gasUserCode collectDeviceCategoryCode collectDeviceResourceCode 
        if (in == null) return null;
        DeviceDailyGasConsumeModel result = new DeviceDailyGasConsumeModel();

        result.setCollectDeviceId(HzhrTypeUtil.integer2integer(in.getCollectDeviceId()));
        result.setIotDeviceId(HzhrTypeUtil.integer2integer(in.getIotDeviceId()));
        result.setGasUserId(HzhrTypeUtil.integer2integer(in.getGasUserId()));
        result.setDeptId(HzhrTypeUtil.integer2integer(in.getDeptId()));
        result.setCompanyId(HzhrTypeUtil.integer2integer(in.getCompanyId()));
        result.setData(HzhrTypeUtil.double2double(in.getData()));
        result.setDate(HzhrTypeUtil.date2long(in.getDate()));
        result.setDataStatus(HzhrTypeUtil.string2string(in.getDataStatus()));
        return result;
    }
    public List<DeviceDailyGasConsumeModel> entityList2deviceDailyGasConsumeModelList(List<DeviceDailyGasConsumeEntity> in) {
        if (in == null) return null;
        List<DeviceDailyGasConsumeModel> result = new ArrayList<>();
        for (DeviceDailyGasConsumeEntity item : in) {
            result.add(entity2deviceDailyGasConsumeModel(item));
        }
        return result;
    }
    public DeviceDailyGasConsumeModel ext2deviceDailyGasConsumeModel(DeviceDailyGasConsumeEntityExt in) {
        //未转换字段: gasUserCode collectDeviceCategoryCode collectDeviceResourceCode 
        if (in == null) return null;
        DeviceDailyGasConsumeModel result = new DeviceDailyGasConsumeModel();

        result.setCollectDeviceId(HzhrTypeUtil.integer2integer(in.getCollectDeviceId()));
        result.setIotDeviceId(HzhrTypeUtil.integer2integer(in.getIotDeviceId()));
        result.setGasUserId(HzhrTypeUtil.integer2integer(in.getGasUserId()));
        result.setDeptId(HzhrTypeUtil.integer2integer(in.getDeptId()));
        result.setCompanyId(HzhrTypeUtil.integer2integer(in.getCompanyId()));
        result.setData(HzhrTypeUtil.double2double(in.getData()));
        result.setDate(HzhrTypeUtil.date2long(in.getDate()));
        result.setDataStatus(HzhrTypeUtil.string2string(in.getDataStatus()));
        return result;
    }
    public List<DeviceDailyGasConsumeModel> extList2deviceDailyGasConsumeModelList(List<DeviceDailyGasConsumeEntityExt> in) {
        if (in == null) return null;
        List<DeviceDailyGasConsumeModel> result = new ArrayList<>();
        for (DeviceDailyGasConsumeEntityExt item : in) {
            result.add(ext2deviceDailyGasConsumeModel(item));
        }
        return result;
    }
    public DeviceDailyGasConsumeGetModel extList2deviceDailyGasConsumeGetModel(List<DeviceDailyGasConsumeEntityExt> extList, Integer total, Integer changeCount, Map<String, Object> query) {
        List<DeviceDailyGasConsumeModel> modelList = extList2deviceDailyGasConsumeModelList(extList);
        if (modelList == null) {
            DeviceDailyGasConsumeGetModel result = new DeviceDailyGasConsumeGetModel();
            result.setTotal(total);
            result.setChangeCount(changeCount);
            return result;
        }

         String _show = HzhrTypeUtil.object2string(query.get("_show"));


        DeviceDailyGasConsumeGetModel result = new DeviceDailyGasConsumeGetModel();
        if ("one".equals(_show)) {
            if (modelList.size() > 0) {
                result.setModel(modelList.get(0));
            }
         }
        if ("list".equals(_show)) {
            result.setModelList(modelList);
        }
        result.setTotal(total);
        result.setChangeCount(changeCount);
        return result;
    }
    public DeviceDailyGasConsumeGetModel entity2deviceDailyGasConsumeGetModel(DeviceDailyGasConsumeEntity entity, Integer total, Integer changeCount, Map<String, Object> query) {
        List<DeviceDailyGasConsumeEntityExt> extList = new ArrayList<>();
        if (entity == null) return extList2deviceDailyGasConsumeGetModel(extList, total, changeCount, query);
        extList.add(HzhrJsonUtil.convertObjectType(entity, DeviceDailyGasConsumeEntityExt.class));
        return extList2deviceDailyGasConsumeGetModel(extList, total, changeCount, query);
     }
    public DeviceDailyGasConsumeEntity deviceDataStatisExceptionReportModel2entity(DeviceDataStatisExceptionReportModel in) {
        //未转换字段: date iotDeviceId companyId gasUserId deptId dataStatus id collectDeviceId 
        if (in == null) return null;
        DeviceDailyGasConsumeEntity result = new DeviceDailyGasConsumeEntity();

        result.setData(HzhrTypeUtil.double2double(in.getExceptionGasConsume()));
        return result;
    }
    public DeviceDailyGasConsumeEntity deviceDataStatisExceptionReportModel2entity(DeviceDataStatisExceptionReportModel in, DeviceDailyGasConsumeEntity ori) {
        //未转换字段: date iotDeviceId companyId gasUserId deptId dataStatus id collectDeviceId 
        if (in == null) return null;
        DeviceDailyGasConsumeEntity result = ori;

        result.setData(HzhrTypeUtil.double2double(in.getExceptionGasConsume()));
        return result;
    }
    public List<DeviceDailyGasConsumeEntity> deviceDataStatisExceptionReportModelList2entityList(List<DeviceDataStatisExceptionReportModel> in) {
        if (in == null) return null;
        List<DeviceDailyGasConsumeEntity> result = new ArrayList<>();
        for (DeviceDataStatisExceptionReportModel item : in) {
            result.add(deviceDataStatisExceptionReportModel2entity(item));
        }
        return result;
    }
    public DeviceDataStatisExceptionReportModel entity2deviceDataStatisExceptionReportModel(DeviceDailyGasConsumeEntity in) {
        //未转换字段: managementName gasUserAddress gasUserName iotDeviceCategoryDes subCompanyName gasUserCode collectDeviceCategoryDes exceptionTypeDes collectDeviceCode iotDeviceCode 
        if (in == null) return null;
        DeviceDataStatisExceptionReportModel result = new DeviceDataStatisExceptionReportModel();

        result.setExceptionGasConsume(HzhrTypeUtil.double2double(in.getData()));
        return result;
    }
    public List<DeviceDataStatisExceptionReportModel> entityList2deviceDataStatisExceptionReportModelList(List<DeviceDailyGasConsumeEntity> in) {
        if (in == null) return null;
        List<DeviceDataStatisExceptionReportModel> result = new ArrayList<>();
        for (DeviceDailyGasConsumeEntity item : in) {
            result.add(entity2deviceDataStatisExceptionReportModel(item));
        }
        return result;
    }
    public DeviceDataStatisExceptionReportModel ext2deviceDataStatisExceptionReportModel(DeviceDailyGasConsumeEntityExt in) {
        //未转换字段: managementName gasUserAddress gasUserName iotDeviceCategoryDes subCompanyName gasUserCode collectDeviceCategoryDes exceptionTypeDes collectDeviceCode iotDeviceCode 
        if (in == null) return null;
        DeviceDataStatisExceptionReportModel result = new DeviceDataStatisExceptionReportModel();

        result.setExceptionGasConsume(HzhrTypeUtil.double2double(in.getData()));
        return result;
    }
    public List<DeviceDataStatisExceptionReportModel> extList2deviceDataStatisExceptionReportModelList(List<DeviceDailyGasConsumeEntityExt> in) {
        if (in == null) return null;
        List<DeviceDataStatisExceptionReportModel> result = new ArrayList<>();
        for (DeviceDailyGasConsumeEntityExt item : in) {
            result.add(ext2deviceDataStatisExceptionReportModel(item));
        }
        return result;
    }
    public DeviceDataStatisExceptionReportGetModel extList2deviceDataStatisExceptionReportGetModel(List<DeviceDailyGasConsumeEntityExt> extList, Integer total, Integer changeCount, Map<String, Object> query) {
        List<DeviceDataStatisExceptionReportModel> modelList = extList2deviceDataStatisExceptionReportModelList(extList);
        if (modelList == null) {
            DeviceDataStatisExceptionReportGetModel result = new DeviceDataStatisExceptionReportGetModel();
            return result;
        }

         String _show = HzhrTypeUtil.object2string(query.get("_show"));


        DeviceDataStatisExceptionReportGetModel result = new DeviceDataStatisExceptionReportGetModel();
        if ("list".equals(_show)) {
            result.setModelList(modelList);
        }
        return result;
    }
    public DeviceDataStatisExceptionReportGetModel entity2deviceDataStatisExceptionReportGetModel(DeviceDailyGasConsumeEntity entity, Integer total, Integer changeCount, Map<String, Object> query) {
        List<DeviceDailyGasConsumeEntityExt> extList = new ArrayList<>();
        if (entity == null) return extList2deviceDataStatisExceptionReportGetModel(extList, total, changeCount, query);
        extList.add(HzhrJsonUtil.convertObjectType(entity, DeviceDailyGasConsumeEntityExt.class));
        return extList2deviceDataStatisExceptionReportGetModel(extList, total, changeCount, query);
     }
    public DeviceDailyGasConsumeCustomQueryModel deviceDailyGasConsumeService_query2queryModel(Map<String, Object> query) {
        DeviceDailyGasConsumeCustomQueryModel queryModel = new DeviceDailyGasConsumeCustomQueryModel();

        Integer _equal_collectDeviceId = HzhrTypeUtil.object2integer(query.get("_equal_collectDeviceId"));
        if (_equal_collectDeviceId != null) {
            queryModel.setEqual_collectDeviceId(_equal_collectDeviceId);
         }

        Integer _equal_iotDeviceId = HzhrTypeUtil.object2integer(query.get("_equal_iotDeviceId"));
        if (_equal_iotDeviceId != null) {
            queryModel.setEqual_iotDeviceId(_equal_iotDeviceId);
         }

        Integer _equal_gasUserId = HzhrTypeUtil.object2integer(query.get("_equal_gasUserId"));
        if (_equal_gasUserId != null) {
            queryModel.setEqual_gasUserId(_equal_gasUserId);
         }

        Integer _equal_deptId = HzhrTypeUtil.object2integer(query.get("_equal_deptId"));
        if (_equal_deptId != null) {
            queryModel.setEqual_deptId(_equal_deptId);
         }

        Integer _equal_companyId = HzhrTypeUtil.object2integer(query.get("_equal_companyId"));
        if (_equal_companyId != null) {
            queryModel.setEqual_companyId(_equal_companyId);
         }

        Date _greaterthan_date = HzhrTypeUtil.object2date(query.get("_greaterthan_date"));
        if (_greaterthan_date != null) {
            queryModel.setGreaterthan_date(_greaterthan_date);
         }

        Date _greaterthanorequal_date = HzhrTypeUtil.object2date(query.get("_greaterthanorequal_date"));
        if (_greaterthanorequal_date != null) {
            queryModel.setGreaterthanorequal_date(_greaterthanorequal_date);
         }

        Date _lessthan_date = HzhrTypeUtil.object2date(query.get("_lessthan_date"));
        if (_lessthan_date != null) {
            queryModel.setLessthan_date(_lessthan_date);
         }

        Date _lessthanorequal_date = HzhrTypeUtil.object2date(query.get("_lessthanorequal_date"));
        if (_lessthanorequal_date != null) {
            queryModel.setLessthanorequal_date(_lessthanorequal_date);
         }

        String _orderBy_date = HzhrTypeUtil.object2string(query.get("_orderBy_date"));
        if (_orderBy_date != null) {
            queryModel.setOrderBy_date(_orderBy_date);
         }

        String _equal_collectDeviceCategoryCode = HzhrTypeUtil.object2string(query.get("_equal_collectDeviceCategoryCode"));
        if (_equal_collectDeviceCategoryCode != null) {
            queryModel.setEqual_collectDeviceExt_categoryCode(_equal_collectDeviceCategoryCode);
         }

        String _like_collectDeviceResourceCode = HzhrTypeUtil.object2string(query.get("_like_collectDeviceResourceCode"));
        if (_like_collectDeviceResourceCode != null) {
            queryModel.setLike_collectDeviceExt_resourceCode(_like_collectDeviceResourceCode);
         }

        queryModel.setShow(true);
        queryModel.setShow(true);
        queryModel.setShow(true);
        queryModel.setShow(true);
        queryModel.setShow(true);
        queryModel.setShow(true);
        queryModel.setShow(true);
        queryModel.setShow(true);
        queryModel.setExt_collectDeviceExt(true);
        queryModel.setShow1(true);
        queryModel.setExt_collectDeviceExt(true);
        queryModel.setShow1(true);
        queryModel.setExt_collectDeviceExt(true);
        queryModel.setShow1(true);

        Integer page = HzhrTypeUtil.object2integer(query.get("_page"));
        Integer count = HzhrTypeUtil.object2integer(query.get("_count"));
        queryModel.setPage(page, count);

        return queryModel;
    }

}

